<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>管理员注册</title>

    <script src="/ss/static/js/crypto-js.js" type="text/javascript"></script>
    <link rel="stylesheet" href="/ss/static/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/ss/static/layui/css/modules/layer/default/layer.css"/>
    <link rel="stylesheet" href="/ss/static/css/global.css"/>
</head>

<body style="background: url(http://www.cduestc.cn/eams/static/images/education-bg.png) no-repeat top center;">

<form id="form" action="/ss/admin/doRegister" method="post" class="layui-container container" style="height: 100vh" onsubmit="return check()">
    <div style="height: 500px;display: flex;flex-direction: column;align-items: center;background-color: beige;border-radius: 30px;justify-content: center">
        <h1 style="font-size: 30px;font-weight: bold">注册学生社团系统(管理员)</h1>
        <input class="layui-input" type="text" name="name" placeholder="名字"
               style="width: 400px;margin-top: 30px"/>
        <input class="layui-input" type="text" name="account" id="account" placeholder="账号"
               style="width: 400px;margin-top: 30px"/>
        <input class="layui-input" type="password" name="password" id="password" placeholder="密码"
               style="width: 400px;margin-top: 30px"/>
        <input style="display: none" name="role" value="admin">
        <div style="margin-top: 30px;display: flex;flex-direction: column; width: 400px">
            <a href="/ss/admin/register" style="cursor: pointer;width: fit-content">没有账号? 点击注册管理员</a>
            <button class="layui-btn" type="submit">登录</button>
        </div>
        <p style="color: red;margin-top: 10px;font-size: 15px" id="info"></p>
    </div>
</form>

<script type="text/javascript">
    function check() {
        let account = document.getElementById('account').value
        let password = document.getElementById('password').value
        if (isEmpty(account) || isEmpty(password)) {
            info('账号或密码不能为空')
            return false
        } else info('')
        document.getElementById('password').value = CryptoJS.SHA1(password).toString()
        return true
    }

    function info(info) {
        document.getElementById('info').innerText = info
    }

    function isEmpty(obj) {
        return typeof obj == "undefined" || obj == null || obj === "";
    }
</script>
</body>

</html>